From 4fdc12dae89db7fd02bfbef1a15a0b78263a7764 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 1 Nov 2022 08:47:21 +0000
Subject: [PATCH] overlays: i2c-sensor: Add mcp980x support

See: https://github.com/raspberrypi/linux/issues/5234

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README               |  4 ++++
 .../boot/dts/overlays/i2c-sensor-common.dtsi    | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1981,6 +1981,10 @@ Params: addr                    Set the
         max30102                Select the Maxim Integrated MAX30102 heart-rate
                                 and blood-oxygen sensor
 
+        mcp980x                 Select the Maxim MCP980x range of temperature
+                                sensors (e.g. MCP9808).
+                                Valid addresses are 0x18-0x1f (default 0x18)
+
         sht3x                   Select the Sensiron SHT3x temperature and
                                 humidity sensor. Valid addresses 0x44-0x45,
                                 default 0x44
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -323,6 +323,20 @@
 		};
 	};
 
+	fragment@21 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			mcp980x: mcp980x@18 {
+				compatible = "maxim,mcp980x";
+				reg = <0x18>;
+			};
+		};
+	};
+
 	__overrides__ {
 		bme280 = <0>,"+0";
 		bmp085 = <0>,"+1";
@@ -346,11 +360,12 @@
 		bh1750 = <0>, "+18";
 		max30102 = <0>,"+19";
 		aht10 = <0>,"+20";
+		mcp980x = <0>,"+21";
 
 		addr =  <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
 			<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
 			<&ds1621>,"reg:0", <&bme680>,"reg:0", <&ccs811>,"reg:0",
-			<&bh1750>,"reg:0";
+			<&bh1750>,"reg:0", <&mcp980x>,"reg:0";
 		int_pin = <&max30102>, "interrupts:0";
 	};
 };
